/*
 * @Description: 类型定义
 * @Author: seadon
 * @LastEditors: seadon
 * @Date: 2021-07-07 10:34:39
 * @LastEditTime: 2022-09-19 10:08:01
 */
import { App, PropType, VNodeChild } from 'vue'

export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>
export const tuple = <T extends string[]>(...args: T) => args

export const tupleNum = <T extends number[]>(...args: T) => args

export type ElementOf<T> = T extends (infer E)[]
	? E
	: T extends readonly (infer F)[]
	? F
	: never

export type LiteralUnion<T extends U, U> = T | (U & {})

export type Data = Record<string, unknown>

export type ObjectData = Record<string, any>

export type Key = string | number

type DefaultFactory<T> = (props: Data) => T | null | undefined

export interface PropOptions<T = any, D = T> {
	type?: PropType<T> | true | null
	required?: boolean
	default?: D | DefaultFactory<D> | null | undefined | object
	validator?(value: unknown): boolean
}

export type VueNode = VNodeChild | JSX.Element
